﻿using Microsoft.AspNetCore.Mvc.Filters;

namespace CommonUtils
{
    public class FilterOfResult : IResultFilter
    {
        public void OnResultExecuted(ResultExecutedContext context)
        {
            (ReflectionUtil.GetSenderClassName() + "." + ReflectionUtil.GetSenderMethodName() + "\r\n"
             + context.HttpContext.Request.Path).Print();
        }

        public void OnResultExecuting(ResultExecutingContext context)
        {
            (ReflectionUtil.GetSenderClassName() + "." + ReflectionUtil.GetSenderMethodName() + "\r\n"
           + context.HttpContext.Request.Path).Print();
        }
        public static void AddTo(IServiceCollection services)
        {
            services.AddMvc(options => options.Filters.Add<FilterOfAuthorization>());
        }
    }
}
